package com.zHan.system.controller.common;

import com.zHan.common.result.Result;
import com.zHan.system.service.ICountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * ClassName: SysCountController
 * Description:
 * date: 2024/1/10 0010 15:31
 *
 * @author zHan
 */
@RestController
@Api(tags = "数量统计接口")
@RequestMapping("/admin/count")
public class CountController {

    @Autowired
    private ICountService countService;

    /**
     * 统计各自的数量
     *
     * @return
     */
    @GetMapping("/quantity")
    @ApiOperation(value = "统计数量")
    public Result quantity() {
        Map<String, Object> map = countService.getAllQuantity();
        return Result.ok(map);
    }

    /**
     * 男女数量
     *
     * @return
     */
    @GetMapping("/sexCount")
    @ApiOperation(value = "男女数量")
    public Result sexCount() {
        Map<String, Object> map = countService.getSexCount();
        return Result.ok(map);
    }

    /**
     * 已分配角色的数量
     *
     * @return
     */
    @GetMapping("/roleCount")
    @ApiOperation(value = "已分配角色的数量")
    public Result roleCount() {
        Map<String, Object> map = countService.getRoleCount();
        return Result.ok(map);
    }

}
